package com.briup.estore.web.servlet;

import com.briup.estore.common.result.Result;
import com.briup.estore.common.vo.BookVO;
import com.briup.estore.service.BookService;
import com.briup.estore.service.impl.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author briup-adam
 * @Date 2023/8/3 下午5:25
 * @Description 检索书籍
 **/
@WebServlet("/book/search")
public class BookSearchServlet extends  BaseServlet {

    private BookService bookService=new BookServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String query = req.getParameter("query");
        List<BookVO> list = bookService.getBook(query);
        writeData(resp,Result.success(list));
    }
}
